package petrochina.company.electric.model;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.Objects;

/**
 * 任务申请区域数据
 */
public class TaskApplyRegionData implements Parcelable {

    // id
    private long id;
    private String regionName;
    private int status;
    private String createTime;

    // 用户状态 0：工人 1：管理员

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getRegionName() {
        return regionName;
    }

    public void setRegionName(String regionName) {
        this.regionName = regionName;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public static Creator<TaskApplyRegionData> getCREATOR() {
        return CREATOR;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeLong(this.id);
        dest.writeString(this.regionName);
        dest.writeInt(this.status);
        dest.writeString(this.createTime);
    }

    public void readFromParcel(Parcel source) {
        this.id = source.readLong();
        this.regionName = source.readString();
        this.status = source.readInt();
        this.createTime = source.readString();
    }

    public TaskApplyRegionData(long id, String regionName, int status, String createTime) {
        this.id = id;
        this.regionName = regionName;
        this.status = status;
        this.createTime = createTime;
    }

    protected TaskApplyRegionData(Parcel in) {
        this.id = in.readLong();
        this.regionName = in.readString();
        this.status = in.readInt();
        this.createTime = in.readString();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof TaskApplyRegionData)) return false;
        TaskApplyRegionData that = (TaskApplyRegionData) o;
        return getId() == that.getId();
    }

    @Override
    public int hashCode() {
        return Objects.hash(getId(), getRegionName(), getStatus(), getCreateTime());
    }

    public static final Creator<TaskApplyRegionData> CREATOR = new Creator<TaskApplyRegionData>() {
        @Override
        public TaskApplyRegionData createFromParcel(Parcel source) {
            return new TaskApplyRegionData(source);
        }

        @Override
        public TaskApplyRegionData[] newArray(int size) {
            return new TaskApplyRegionData[size];
        }
    };
}
